﻿<div class="ph-tabs">
    <ul>
        <li class="k-state-active">学校列表</li>
    </ul>
    <div>
        <div class="k-block divToolbar">
            <span class="k-textbox k-space-right">
                <input type="text" placeholder="请输入学校名称" id="txtKey" />
                <a href="javascript:Filter()" class="k-icon k-i-search">&nbsp;</a>
            </span>
        </div>
        <div id="grid_school" style="text-align: center"></div>
    </div>
</div>

<script class="init">
    LocatedMenu("单位管理", "直属学校");
</script>

<script class="grid_school_columns">
    var schoolFields = [{
        title: "学校名称",
        field: "SchoolName",
        attributes: { style: "text-align:left" },
        width: 260
    }, {
        title: "类型",
        field: "SchoolType",
        width: 100
    }, {
        title: "人数",
        field: "PersonCount",
        width: 50
    }, {
        title: "用户名",
        field: "User.UserName",
        width: 100
    }, {
        title: "姓名",
        field: "User.RealName",
        width: 100
    }, {
        title: "联系手机",
        field: "User.Mobile",
        width: 100
    }, {
        title: "Email",
        field: "User.Email",
        width: 150
    }, {
        title: "添加时间",
        template: "#=kendo.toString(kendo.parseDate(CreatedOn),'yyyy-MM-dd')#",
        width: 100
    }, {}];

</script>

<script class="grid_config">
    $(function () {
        $("#grid_school").kendoGrid({
            columns: schoolFields,
            dataSource: Whale.dataSource({
                url: "/School/SchoolInfo/GetSchoolList",
                getParameters: function () {
                    return {
                        key: $.trim($("#txtKey").val()),
                        getPersonCount: true,
                        getSchoolType:true,
                        getUser:true
                    };
                },
                pageSize: 20

            }),
            pageable: {
                messages: {
                    empty: "暂无数据"
                }
            },
            dataBound: function (e) {
                //让表头居中
                $("th.k-header").attr("style", "text-align:center; font-weight:bold;");
            }
        });
    });

    function CreateNewSchool() {
        wndGeneralEdit.setOptions({ title: "添加新的学校" });
        wndGeneralEdit.refresh({ url: "/School/SchoolInfo/Edit" });
        wndGeneralEdit.open();
    }

    function Filter() {
        $("#grid_school").data("kendoGrid").dataSource.page(0);
    }
</script>
